namespace ClassLibrary1.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class InitialCreate : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Bills",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        OwedBy_Id = c.Int(),
                        OwedTo_Id = c.Int(),
                        Status_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Users", t => t.OwedBy_Id)
                .ForeignKey("dbo.HealthCareEntities", t => t.OwedTo_Id)
                .ForeignKey("dbo.BillStatus", t => t.Status_Id)
                .Index(t => t.OwedBy_Id)
                .Index(t => t.OwedTo_Id)
                .Index(t => t.Status_Id);
            
            CreateTable(
                "dbo.Users",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        FirstName = c.String(),
                        LastName = c.String(),
                        Address = c.String(),
                        Email = c.String(),
                        Username = c.String(),
                        Password = c.String(),
                        InsuranceNumber = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.HealthCareEntities",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        Address = c.String(),
                        Email = c.String(),
                        Username = c.String(),
                        Password = c.String(),
                        Type_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.HealthCareEntityTypes", t => t.Type_Id)
                .Index(t => t.Type_Id);
            
            CreateTable(
                "dbo.HealthCareEntityTypes",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.BillStatus",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.Examples",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Hello = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.OrderLines",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Description = c.String(),
                        Code = c.String(),
                        Amount = c.Int(nullable: false),
                        Date = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.Id);
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.Bills", "Status_Id", "dbo.BillStatus");
            DropForeignKey("dbo.Bills", "OwedTo_Id", "dbo.HealthCareEntities");
            DropForeignKey("dbo.HealthCareEntities", "Type_Id", "dbo.HealthCareEntityTypes");
            DropForeignKey("dbo.Bills", "OwedBy_Id", "dbo.Users");
            DropIndex("dbo.HealthCareEntities", new[] { "Type_Id" });
            DropIndex("dbo.Bills", new[] { "Status_Id" });
            DropIndex("dbo.Bills", new[] { "OwedTo_Id" });
            DropIndex("dbo.Bills", new[] { "OwedBy_Id" });
            DropTable("dbo.OrderLines");
            DropTable("dbo.Examples");
            DropTable("dbo.BillStatus");
            DropTable("dbo.HealthCareEntityTypes");
            DropTable("dbo.HealthCareEntities");
            DropTable("dbo.Users");
            DropTable("dbo.Bills");
        }
    }
}
